package com.jungle.mvvm.net;



import com.jungle.mvvm.utils.AppUtil;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;


/**
 * 详细说明
 *
 * @author Daniel
 * @version V1.0
 * @date 2020/12/25 11:34
 */
public class RequestInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        String time = System.currentTimeMillis() + "";
        Request.Builder builder = chain.request().newBuilder();
        builder.addHeader("os", "android");
        builder.addHeader("v-Code", AppUtil.getAppVersionCode() + "");
        builder.addHeader("v-Name", AppUtil.getAppVersionName());
        builder.addHeader("date", time);
        return chain.proceed(builder.build());
    }
}
